package com.wjjun.customview.window;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;

import com.wjjun.customview.R;

/**
 * loading对话框
 * Created by 67535 on 2018/5/9.
 */
public class LoadingDialog extends BaseDialog {

    public LoadingDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_loading;
    }

    @Override
    protected void initContent() {
        super.initContent();
        setCanceledOnTouchOutside(false);
    }


    @Override
    public BaseDialog setTitleByRes(int resId) {
        super.setTitleByRes(resId);
        if (resId == 0) {
            titleView.setVisibility(View.GONE);
        } else {
            titleView.setVisibility(View.VISIBLE);
        }
        return this;
    }

    @Override
    public BaseDialog setTitle(String title) {
        super.setTitle(title);
        if (TextUtils.isEmpty(title)) {
            titleView.setVisibility(View.GONE);
        } else {
            titleView.setVisibility(View.VISIBLE);
        }
        return this;
    }
}
